package org.example.controller;

import org.example.domain.model.Result;
import org.example.service.impl.AdvertisingsServiceImpl;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/advertising")
@CrossOrigin("*")
public class AdvertisingController {

    private AdvertisingsServiceImpl advertisingsService;

    public AdvertisingController(AdvertisingsServiceImpl advertisingsService) {
        this.advertisingsService = advertisingsService;
    }

    @GetMapping("/select")
    public Result selectAdvertising(){
        return advertisingsService.selectAdvertisings();
    }

    @GetMapping("/show")
    public Result showAdvertising(@RequestParam Integer id){
        return advertisingsService.showAdvertisings(id);
    }

    @GetMapping("/hidden")
    public Result hiddenAdvertising(@RequestParam Integer id){
        return advertisingsService.hiddenAdvertising(id);
    }

    @GetMapping("/delete")
    public Result deleteAdvertising(@RequestParam Integer id){
        return advertisingsService.deleteAdvertising(id);
    }
}
